/*
 * @lc app=leetcode.cn id=LCR 164 lang=cpp
 * @lcpr version=30204
 *
 * [LCR 164] 破解闯关密码
 */

// @lcpr-template-start
using namespace std;
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <queue>
#include <stack>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
// @lcpr-template-end
// @lc code=start
class Solution
{
public:
    static bool cmp(int a, int b)
    {
        string as = to_string(a);
        string bs = to_string(b);
        return as + bs < bs + as;
    }
    string crackPassword(vector<int> &password)
    {
        int size = password.size();
        string ans = "";
        sort(password.begin(), password.end(), cmp);
        for (int i = 0; i < size; i++)
        {
            ans += to_string(password[i]);
        }

        return ans;
    }
};
// @lc code=end

/*
// @lcpr case=start
// [15, 8, 7]\n
// @lcpr case=end

// @lcpr case=start
// [0, 3, 30, 34, 5, 9]\n
// @lcpr case=end

 */
